-
Notifications
You must be signed in to change notification settings - Fork 0
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Menus and React Testing Library migration #359
Conversation
…on.dialog.showOpenDialog
… during testing; resolves #90
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Analyzing this issue shows two likely separate problems on the Windows platform, that originate in the
|
There is an open issue, stevenvachon/hidefile#3, that suggests others are also having trouble with the Fix in branch |
After testing the
Warning: Can't perform a React state update on an unmounted component. This is a no-op, but it indicates a memory leak in your application. To fix, cancel all subscriptions and asynchronous tasks in a useEffect cleanup function. |
The leaking memory error has actually been occurring on Windows for awhile now. After going back through the project history, we were able to narrow it down to being introduced sometime between c88e8cb (August 25, 2020) and e743c32 (September 11, 2020) on the Also, it appears that the |
Description:
The initial interaction points within the Synectic canvas have been based on buttons managed within their respective card, stack, error, and dialog components. This is not a sustainable architecture going forward. A unified navigation menu, similar to the design considerations of https://material.io/components/menus, has prompted a refactoring to a single
NavMenu
component that launches all interactions via Redux actions.Additionally, we have been maintaining tests written for both Enzyme and React Testing Library (RTL). However, issues such as #357 highlight that this structure is untenable as dependencies for their testing libraries begin to conflict. Its time to cut-over to using React Testing Library (RTL) only, and any remaining Enzyme tests need to be updated.
This PR resolves #90, #357, and #113, and signifies the following version changes:
Changes:
This PR makes the following changes:
@testing-library/user-event
fromdependencies
todevDependencies
inpackage.json
to match other@testing-library/*
packages.@testing-library/dom
added todevDependencies
to allow DOM queries to work in conjunction with React Testing Library.react-dnd-test-utils
from 11.1.3 to 12.0.0 to take advantage of the updatedwrapWithTestBackend
that wraps components with aDnDContext
and returns[Component, getBackend]
utilities; this removed the need fordndReduxMock.wrapInReduxContext
in our test mocks.Card.saveable
field type dropped in favor ofMetafile.state
field type.Editor
cards able to save content whenMetafile.state
indicates amodified
state.FilePickerDialog
converted to a function returning a Redux Thunk for handling calls toElectron.dialog.showOpenDialog
.filePickerDialog
displays anElectron.dialog.showOpenDialog
based on a newpickerType: openFile | openDirectory
parameter for accepting only files or directories (defaults to both only on MacOS platforms, see Electron.remote.dialog.showOpenDialog limits FilePicker dialog to directory selector on Windows and Linux #113).NewCardDialog
,DiffPickerDialog
,RepoBranchList
,FilePickerDialog
,MergeDialog
.Modal
types) instead of state flags that control component rendering.GitGraph
added to canvas background through Redux actions (via the newModal
types).basePath
andmodePath
for dynamic importing of syntax highlighting modes in Jest testing environments (see Jest is unable to resolve file-loader! imports for react-ace/webpack-resolver.js #90).__test__/__fixtures__/*
created to hold a single consistent Redux store (along with validCanvas
,Card
,Stack
,Modal
, andMetafile
entries) for reduced boilerplate code in tests.testEnvironment: 'enzyme'
totestEnvironment: 'jest-environment-jsdom-sixteen'
based on recommendations documented inTypeError: MutationObserver is not a constructor
#357).useDirectory
React Hook to no longer rely on changes occurring inmetafile.ts
for determining the status of child directories and files within a root directory; instead the only dependencies are inio.ts
and state is determined by checking with the underlying filesystem. This fixes underlying memory leaks and Windows OS issues (see useDirectory mock must return fetch with () => Promise<void> type #321).Checklist:
Before submitting this PR, I have verified that my code:
fix/
orfeature/
branch that was initially branched off fromdevelopment
.yarn lint
) and unit testing (yarn test
).yarn package
).Additionally, I have verified that: